Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AEIP-19 token recipients #1214

Conversation

bchamagne
Copy link
Member

@bchamagne bchamagne commented Aug 4, 2023

Description

/!\ Base branch 1174-token-resupply (AEIP-18)
This is AEIP-19 implementation. This adds a recipients field in the token transactions. Minted tokens can be sent to recipients in the same transaction.

Fixes #1175

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Scenario 1: Create a token with recipients

transaction_type: token
content: |
  {
    "supply": 10000000000,
    "type": "fungible",
    "decimals": 8,
    "name": "COINCOIN",
    "allow_mint": true,
    "recipients": [
      {"to": "00002223bbd4ec3d64ae597696c7d7ade1cee65c639d885450ad2d7b75592ac76afa", "amount": 333}
    ],
    "aeip": [2, 18]
  }
go run main.go send-transaction --config newtoken.yaml --access-seed bastien --index 0
  • Check the movements in resulting

Scenario 2:

  • Create a resupply with recipients
transaction_type: token
content: |
  {
    "aeip": [2,18],
    "supply": 100000000,
    "recipients": [{"to": "00002223bbd4ec3d64ae597696c7d7ade1cee65c639d885450ad2d7b75592ac76afa", "amount": 100000000}],
    "token_reference": "000058C44C933FBD047BF694490371BB41DA037597FFD57970A1DE6832AF990B7752"
  }
go run main.go send-transaction --config supply.yaml --access-seed bastien --index 1
  • Check the movements in resulting

Many unit tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bchamagne bchamagne added mining Involve transaction validation and mining AEIP labels Aug 4, 2023
lib/archethic/mining/pending_transaction_validation.ex Outdated Show resolved Hide resolved
lib/archethic/mining/pending_transaction_validation.ex Outdated Show resolved Hide resolved
lib/archethic/mining/pending_transaction_validation.ex Outdated Show resolved Hide resolved
lib/archethic/mining/pending_transaction_validation.ex Outdated Show resolved Hide resolved
lib/archethic/mining/pending_transaction_validation.ex Outdated Show resolved Hide resolved
lib/archethic/replication/transaction_validator.ex Outdated Show resolved Hide resolved
lib/archethic/transaction_chain/transaction.ex Outdated Show resolved Hide resolved
lib/archethic/transaction_chain/transaction.ex Outdated Show resolved Hide resolved
lib/archethic/transaction_chain/transaction.ex Outdated Show resolved Hide resolved
@bchamagne bchamagne changed the title 1175 token mint and send AEIP-19 token recipients Aug 16, 2023
@Neylix Neylix merged commit 75b7d5a into archethic-foundation:1174-token-resupply Aug 22, 2023
1 check passed
Neylix added a commit that referenced this pull request Aug 30, 2023
* add recipients to token creation schema

* add recipients to resupply schema

* verify token recipients address & amount

* wip - inconsisentencies tx movment

* wip - error insufficient funds

* wip

* refactor consume_inputs

* lint: add ledgerops.tokens_to_mint

* unit test ledger operations

* unit test transaction.get_movements/1

* add more unit tests

* credo

* Fetch in parallel

* lint after feedback

* Fees take token recipients into account

* Lint + add token_id verification

---------

Co-authored-by: Neylix <julien.leclerc05@protonmail.com>
Neylix added a commit that referenced this pull request Aug 30, 2023
* add recipients to token creation schema

* add recipients to resupply schema

* verify token recipients address & amount

* wip - inconsisentencies tx movment

* wip - error insufficient funds

* wip

* refactor consume_inputs

* lint: add ledgerops.tokens_to_mint

* unit test ledger operations

* unit test transaction.get_movements/1

* add more unit tests

* credo

* Fetch in parallel

* lint after feedback

* Fees take token recipients into account

* Lint + add token_id verification

---------

Co-authored-by: Neylix <julien.leclerc05@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AEIP mining Involve transaction validation and mining
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants